import { createApp } from 'vue'
import './style.css'
import './common.scss'
import App from './App.vue'
import router from "@/router/index.js";
import { ElMessage } from "element-plus";
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import pinia from "@/store";
import * as echarts from 'echarts';
import i18n from "@/i18n";
import zh from "element-plus/es/locale/lang/zh-cn";
import en from "element-plus/es/locale/lang/en";
// const lang=''
// if(localStorage.getItem("lang")){
//      lang = localStorage.getItem("lang").includes("zh-CN");
// }
const  lang = localStorage.getItem("lang");
const app= createApp(App)

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
app.use(i18n);
app.use(router)
app.use(ElementPlus, {
    locale: lang ? zh : en,
});
app.use(pinia);
app.mount('#app')
app.config.globalProperties.$message = ElMessage;
app.config.globalProperties.$echarts = echarts // 全局挂载echarts
